import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { PropertyService } from '../service/property.service';
import { Message, ConfirmationService } from 'primeng/api';
import { FileUpload } from 'primeng/fileupload';
import { ConstantVariable } from '../../shared/config/app-settings';
import {CRUD_MODE} from '../../shared/config/app-settings';
import { UserService } from '../../shared/services/user.service';
@Component({
  selector: 'app-property-detail',
  templateUrl: './property-detail.component.html',
  styleUrls: ['./property-detail.component.css']
})
export class SharedPropertyDetailComponent implements OnInit {
  CRUD_MODE = CRUD_MODE;
  user: any = {};
  //message
  msgs: Message[] = [];
  menuKey: string = '';
  mode: string;
  id: number = 1;
  debug: number = 0;
  

  constructor(public route: ActivatedRoute, private router: Router,
    private PropertyService: PropertyService,
    private confirmationService: ConfirmationService,
    private userService:UserService) { }

  ngOnInit() {

    this.route.params.subscribe(params => {
      this.id = params['id']; // (+) converts string 'id' to a number
      console.log('id : ' + this.id);
    });


    this.route.queryParams.subscribe(params => {
      this.menuKey = params['menuKey'];
      this.mode = params['mode'];
      this.debug = params['debug'];
      console.log(params); 
    });
    this.getCurrentUser();

  }

  getCurrentUser(){
    this.userService.getCurrentUser().subscribe((user)=>{
      this.user = user;
    });
  }





  

  //server exchange
  
}
